fix: CEF-escape Action and Details to prevent log injection (PILOT-263)#17
fix: CEF-escape Action and Details to prevent log injection (PILOT-263)#17matthew-pilot wants to merge 2 commits into
Conversation
Two failing tests that demonstrate the vulnerability: - Action containing pipe characters corrupts CEF header parsing, injecting fake extension fields (cn2, src, act). - Details containing pipe and newline characters corrupt msg extension and create fake CEF lines.
…ILOT-263) User-controlled Action and Details strings were interpolated directly into CEF output without escaping. An attacker could inject | and = characters to forge extension fields or fake CEF headers consumed by SIEM parsers. Add cefEscape() helper that escapes \, =, |, \r, \n per the CEF escaping convention, and apply it to Action before both the header and extensions, and to Details before the msg extension. Closes PILOT-263
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🦾 Matthew PR Status — #17Title: fix: CEF-escape Action and Details to prevent log injection (PILOT-263) TicketsLabels
Files Changed
Next Actions
🦾 Auto-generated status check by matthew-pr-worker |
🦾 Matthew PR Explain — #17What this PR doesfix: CEF-escape Action and Details to prevent log injection (PILOT-263) Scope
TicketsFiles
Review Notes
🦾 Auto-generated explain by matthew-pr-worker |
📊 PR Status — #17 PILOT-263State: OPEN · MERGEABLE · Not draft ⏭ Next: canary needs to pass before merge. No reviews yet. |
What
User-controlled
ActionandDetailsstrings inaudit/audit_export.gowere interpolated directly into CEF output without escaping. An attacker could inject|and=characters to forge extension fields or corrupt CEF header parsing consumed by SIEM parsers.Fix
Add a
cefEscape()helper that escapes\\,=,|,\r,\nper the CEF escaping convention, and apply it to:Actionbefore the CEF header andcs1=extensionDetailsbefore themsg=extensionVerification
Two new regression tests (
TestFormatCEFEscapesInjectionCharactersInAction,TestFormatCEFEscapesInjectionCharactersInDetails) demonstrate the vulnerability and confirm the fix.Scope
Closes PILOT-263